#include <stdio.h>
#include <limits.h>

int main()
{
	unsigned int nbbits = sizeof(unsigned int)*CHAR_BIT;
	unsigned int a = 15;
	unsigned int valbit=0;
	unsigned int constante;
	int i;
	int num=3;
	
	/*Question B*/
	if (a & 1)
	{
	valbit = 1;
	}
	else
	{
	valbit = 0;
	}

	printf("le bit de poids faible de a vaut :  %d \n", valbit);
	
	/*Question C*/
	printf(" le bit numéro %d vaut : ",num+1);
	printf("%d\n", (a >> num)& 1 );
	
	/*Question D*/
	
	printf("%d en binaire : ", a);
	for (i = 31; i >= 0; i=i-1)
	{
		printf("%d", (a >> i )& 1); 
	}	
	printf("\n");
	return 0 ;
}
